<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>15题</title>
    <script>
        function caculate(flag) {
            var num = prompt(flag ? '请输入正确的数' : '请输入一个数');
            if (!/^[0-9]*$/i.test(num)) {
                caculate(true);
                return;
            }
            // 能被5整除
            let isCanFive = parseInt(num) % 5;
            // 能被6整除
            let isCanSix = parseInt(num) % 6;
            if (!isCanFive && !isCanSix) {
                alert(`${num}能同时被5和6整除`);
            } else if (!isCanFive && isCanSix) {
                alert(`${num}只能被5整除`);
            } else if (isCanFive && !isCanSix) {
                alert(`${num}只能被6整除`);
            } else {
                alert(`${num}不能被5和6整除`);
            }
        }
    </script>
</head>
<body>
    <p>
        请输入一个数<input type="button" value="点击输入" onclick="caculate()">
    </p>
</body>
</html>